Python Project.save方法代码示例

您所在的位置:网站首页 project save as Python Project.save方法代码示例

Python Project.save方法代码示例

2024-06-12 01:24| 来源: 网络整理| 查看: 265

本文整理汇总了Python中models.Project.save方法的典型用法代码示例。如果您正苦于以下问题:Python Project.save方法的具体用法?Python Project.save怎么用?Python Project.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Project的用法示例。

在下文中一共展示了Project.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addproject # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def addproject(request): # If a user is authenticated and this is a post request, then # we proceed. Otherwise return an invalid page U = request.user if request.user.is_authenticated() and request.POST: deadline = request.POST.get('deadline') pid = int(request.POST.get('parentid')) projectname = request.POST.get('projectname') projectColor = taskViews.genRandomColor(); P = Project(user=U,name=projectname,date_started=timezone.now(),deadline=deadline,date_finished=timezone.now(),parentid=pid,color=projectColor) P.save() # Loop through all the tasks posted with this project and create them as # unassigned tasks if they don't have deadlines index = 1; while not (request.POST.get(str(index)) is None): newTaskName = request.POST.get(str(index)) taskDeadline = request.POST.get("time"+str(index)) timeRequired = request.POST.get("timeReq"+str(index)) index = index + 1 if newTaskName == "": continue else: taskViews.createTaskForUserFromList(newTaskName,U,P,taskDeadline,timeRequired) return HttpResponseRedirect('/todolist/projects'+str(U.id)) else : return HttpResponseRedirect('/todolist/invalid_project_add')开发者ID:jhb563,项目名称:ProductivityApp,代码行数:36,代码来源:projectViews.py 示例2: parse_project # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def parse_project(filepath, uploaddate, Document, p_uuid): f = csv.DictReader(Document, delimiter=',') Document.close() for row in f: row_dict = row m = Project(projectid=p_uuid, path=filepath, upload_date=uploaddate, **row_dict) m.save()开发者ID:EntzeChong,项目名称:PhyloDB,代码行数:9,代码来源:parsers.py 示例3: newProject # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def newProject(request, projectname, monthlygoal): print projectname project = Project() project.user = request.user project.name = projectname if monthlygoal != "": project.monthlygoal = int(monthlygoal) goal = project.monthlygoal else: goal = "-" print project project.save() print "qwe" dajax = Dajax() dajax.remove("#newrow") row = """ {1} {2} 0 """.format(project.id, projectname, goal) print row dajax.append("#projecttable", "innerHTML", row) dajax.script("$('#newprojectbutton').show();") return dajax.json()开发者ID:laerador,项目名称:octo-time,代码行数:27,代码来源:ajax.py 示例4: register # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def register(): if requesthod=='POST' and request.form['company']: #deal with uploaded files full_path = '' if request.files['file_path']: file_obj = request.files['file_path'] file_name = file_obj.filename full_path = os.path.join(app.config['PROJECT_FOLDER'], file_name) file_obj.save(full_path) #insert a new project project = Project(company = request.form['company'], address = request.form['address'], invest = request.form['invest'], time = request.form['time'], name = request.form['name'], major = request.form['major'], phone = request.form['phone'], email = request.form['email'], position = request.form['position'], holds = request.form['holds'], introduction = request.form['introduction'], team = request.form['team'], business = request.form['business'], file_path = full_path ) project.save() msg = 'success' return render_template('register.html', msg = msg) print 'not' return render_template('register.html')开发者ID:sparkmorry,项目名称:zaec,代码行数:36,代码来源:views.py 示例5: addProject # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def addProject(request): """ Creates a new project in the database Returns a JSON thingied thing with the id on success, or an error message otherwise """ if requesthod == "POST": try: inputData = json.loads(request.POST['DATA']) newProject = Project() newProject.name = inputData['name'] newProject.save() if len(inputData['components']) > 0: #We have to ensure we have these components in the linker table for component_id, quantity in inputData['components']: component = Component.objects.filter(id=component_id).get() newBOMQuant = BOMQuant.objects.create(project=newProject, component=component, quantity=quantity) if len(inputData['notes']) > 0: #add lots of notes if we have any for note_id in inputData['notes']: newNote = Note.objects.filter(id=note_id).get() newProject.notes.add(newNote) newProject.save() json_data = json.dumps({"HTTPRESPONSE": newProject.id}) except Exception, e: json_data = json.dumps({"ERROR": e.message})开发者ID:daubers,项目名称:ComponentStock,代码行数:29,代码来源:views.py 示例6: promoteTask # 需要导入模块: from models import Project [as 别名] # 或者: from models.Project import save [as 别名] def promoteTask(request): # Deletes this task, and instead makes it into a project with the same deadline U = request.user if request.user.is_authenticated() and request.POST: # Get task, turn into projects taskID = request.POST.get('taskid','') taskID = int(taskID) Ts = Task.objects.filter(user = U, id = taskID) if len(Ts)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3